#ifndef SHAPE_H
#define SHAPE_H

#include "vector.h"
#include "box.h"

#define _IN 0
#define _OUT 1

#ifndef Q_MOC_RUN
#include <boost/random/taus88.hpp>
#include <boost/random.hpp>
#endif



using namespace boost::random;

#include <QString>

class Shpere;
class Cylindre;
class Cone;

class Shape
{
public:
    QString _name;
    Box _bounds;
    double _refraction;
    double _diffusion;
    double _specularity;
    double _glossy;
    double _roughness;
    Vector _emission;
    Vector _absorbtion;
    Vector _position;
    Vector _rotation;
    discrete_distribution<> _dist;

    Shape(QString name = "",
          double refraction = 0.0,
          double diffusion = 1.0,
          double specularity = 0.0,
          double glossy = 0.0,
          double roughness = 0.0,
          Vector emission = Vector(0,0,0),
          Vector absorbtion = Vector(1,1,1),
          Vector position = Vector(0,0,0),
          Vector rotation = Vector(0,0,0)
    );
    virtual ~Shape();
    bool operator==(const Shape& value);

    virtual bool intersect(const Ray &ray, double *distance, Vector *normal) const = 0;
    virtual bool inside(const Vector& dot) const = 0;
    const Box& getBoundingBox() const;
    bool isEmiter() const;

    double refraction() const;
    double diffusion() const;
    double specularity() const;
    double glossy() const;
    double roughness() const;
    const Vector& emission() const;
    const Vector& absorbtion() const;
    const Vector& position() const;
    const Vector& rotation() const;

    void setRoughness(double value);
    void setGlossy(double value);
    void setRefraction(double value);
    void setDiffusion(double value);
    void setSpecularity(double value);
    void setEmission(const Vector& value);
    void setAbsorbtion(const Vector& value);
    void setPosition(const Vector& value);
    void setRotation(const Vector& value);

    friend QDataStream &operator<<(QDataStream &, const Shape &);
    friend QDataStream &operator>>(QDataStream &, Shape &);

};


#endif // SHAPE_H
